package com.woniuxy.microgoldservice.mapper;

import com.woniuxy.microgoldservice.bean.AssetDAO;
import com.woniuxy.microgoldservice.bean.GoldOrderDAO;
import com.woniuxy.microgoldservice.bean.GoldPurchase;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author hongbin
 * @date 2021-04-13 20:19
 * Description：黄金订单详情
 */

public interface GoldPurchaseMapper {
    GoldPurchase getPurchase(String userId);

    int savePurchase(@Param("grammage") BigDecimal grammage,@Param("money") Double money,@Param("username") String username,@Param("proId") Long proId);

    int redemptionGold(@Param("username") String username,@Param("grammage") Double grammage,@Param("monetary") Double monetary);

    boolean selectExistsPurchase(String username);

    int addPurchase(@Param("username") String username,@Param("money") Double money,@Param("grammage") BigDecimal grammage);

    int addEarnings(@Param("productName") String productName,@Param("money") Double money);


    BigDecimal queryInventory(String userName);

    AssetDAO getAsset(String userName);

    BigDecimal getHoldGrammage(String userName);


    Integer setMonetary(BigDecimal price);

    int addPurchaseOrder(@Param("proId") Long proId,@Param("userName") String userName
            ,@Param("grammage") BigDecimal grammage, @Param("price") Double nowGoldPrice,@Param("cost") Double cost);

    List<GoldOrderDAO> selectAllCost();

    int updateHoldingGains(List<GoldOrderDAO> goldOrderDAOS);

    List<Map<String , Object>> selectPurchaseOrderByUserName(String username);

    int deleteOrder(List<Long> ids);

    int updateResidueGrammage(@Param("flageId") Long flageId,@Param("residueGrammage") BigDecimal residueGrammage);

    int deleteToFlageId(Long flageId);
}
